package huaweiod.first;

import java.util.Scanner;

/**
 * 华为OD机试真题 Java 实现【不含 101 的数】【2022.11 Q4新题】
 */
public class A_2023_07_Exclude101Sum {

    public static void main(String[] args) {
        // 处理输入
        Scanner in = new Scanner(System.in);
        int left  = in.nextInt();
        int right  = in.nextInt();

        int ans = 0;
        for (int i = left; i <= right; i++) {
            String binaryString = Integer.toBinaryString(i);
            if(!binaryString.contains("101")) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}
